import React, { useCallback } from 'react';

import styles from './use_history.css';
import { useHistory } from 'dva';
import { Link } from 'umi';
console.log({ useHistory });

export default function() {
  const onCanelLink = useCallback((e: MouseEvent) => {
    if (!e.altKey) return;
    // e.cancelBubble = true;
    // e.stopPropagation();
    e.preventDefault(); // 只要单独有这个就能确保 Link 不接受
  }, []);
  return (
    <div className={styles.normal}>
      <h1>Page use_history</h1>
      <div>
        <Link to="./closure">
          <span onClick={onCanelLink}>capture click</span>
        </Link>
      </div>
    </div>
  );
}
